#include <bits/stdc++.h>
using namespace std;
struct classmate{
    string name;
    int chinese, math, englsh;
    int zong;
    int id;
}a[1005];
bool cmp(classmate x, classmate y){
    if (x.zong != y.zong) return x.zong > y.zong;
    return x.id < y.id;
}
int main(){
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> a[i].name >> a[i].chinese >> a[i].math >> a[i].englsh;
        a[i].zong = a[i].chinese + a[i].math + a[i].englsh;
        a[i].id = i;
    }
    sort(a + 1, a + n + 1, cmp);
    cout << a[1].name << " " << a[1].chinese << " " << a[1].math << " " << a[1].englsh;
    return 0;
}